package com.server.llh.llhserverwork.adapter;

import java.util.ArrayList;



import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.llh.llhsuppliers.R;
import com.server.llh.llhserverwork.app.LelaohuirelativesApp;

public class LLHOrderFoodTypeAdapter extends BaseAdapter {

	private ArrayList<String> array = new ArrayList<String>();
	private LayoutInflater inflater;

	public LLHOrderFoodTypeAdapter() {
		inflater = LayoutInflater.from(LelaohuirelativesApp.getLelaohuirelativesApp());
	}

	public void setData(ArrayList<String> data) {
		array.clear();
		array.addAll(data);
		this.notifyDataSetChanged();
	}

	@Override
	public int getCount() {
		return array.size();
	}

	@Override
	public Object getItem(int position) {
		return array.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (null == convertView) {
			convertView = inflater.inflate(R.layout.llh_lv_left_view,
					null);
		}
		TextView type = (TextView) convertView.findViewById(R.id.list_item_btn1);
		type.setText(array.get(position));
		return convertView;
	}

}
